import {defHttp} from '/@/utils/http/axios';
import {Modal} from 'ant-design-vue';

enum Api {
  list = "/pay-service/mgr/payWay/page",
  save = "/pay-service/mgr/payWay/save",
  getByWayCode = "/pay-service/mgr/payWay/getByWayCode",
  listPayWay = "/pay-service/mgr/payWay/listPayWay",
  edit = "/pay-service/mgr/payWay/update",
  delete = "/pay-service/mgr/payWay/deleteByWayCode",
}


/**
 * 查询列表
 * @param params
 */
export const listPayWay = (params) => {
  return defHttp.get({url: Api.list, params});
}

/**
 * 查询列表
 * @param params
 */
export const listAllPayWay = () => {
  return defHttp.get({url: Api.listPayWay, params: {}});
}

/**
 * 获取相信信息
 * @param params
 */
export const getPayWay = (params) => {
  return defHttp.get({url: Api.getByWayCode, params});
}


/**
 * 删除
 * @param params
 */
export const deletePayWay = (params, handleSuccess) => {
  return defHttp.delete({url: Api.delete, data: params}, {joinParamsToUrl: true}).then(() => {
    handleSuccess();
  });
}


/**
 * 保存或者更新角色
 * @param params
 */
export const saveOrUpdateMch = (params, isUpdate) => {
  let url = isUpdate ? Api.edit : Api.save;
  return defHttp.post({url: url, params});
}


